
$(function() {
$('.banner').unslider({
	speed: 500,               //  The speed to animate each slide (in milliseconds)
	delay: 3000,              //  The delay between slide animations (in milliseconds)
	complete: function() {},  //  A function that gets called after every slide animation
	keys: true,               //  Enable keyboard (left, right) arrow shortcuts
	dots: true,               //  Display dot navigation
	fluid: false              //  Support responsive design. May break non-responsive designs
})
});

var unslider = $('.banner').unslider();

$('.unslider-arrow').click(function() {
    var fn = this.className.split(' ')[1];
    
    //  Either do unslider.data('unslider').next() or .prev() depending on the className
    unslider.data('unslider')[fn]();
});


// **************************************
// Partie chargement des images
// **************************************

// Tableau
var tabImages = new Array(4);

function initialiserImage() {

	// Cr�er un tableau d'images
	for ( var i = 0; i < tabImages.length; i++) {
		tabImages[i] = new Image();
		tabImages[i].src = "Images/sea_" + i + ".jpg";
	}

}

var j = 0;
function changementImage() {
	document.images["monImage"].src = tabImages[j].src;
	if (j == tabImages.length - 1) {
		j = 0;
	} else {
		j++;
	}

}

function validerEmail(inputtext) {
	// Controle Validation email
var mailformat = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (inputtext.value.match(mailformat)) {
alert ('Bienvenue sur notre site cinepantin');
return true ;
	} else {
alert('email invalide !')
return false;
}

}

// **************************************
// password de 8 a 15 caracter, contient au moin une lettre majuscule et
// minuscule
// un nombre et un caracter speciale

function CheckPassword(inputtxt) {
	var decimal = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
	if (inputtxt.value.match(decimal)) {
		alert('Correct, try another...')
		return true;
	} else {
		alert('Wrong...!')
		return false;
	}
}

var img = 1;
function slideshow() {
	img++;
	document.getElementById('mainImage').innerHTML = document
			.getElementById('image_' + img).innerHTML;
	if (img == 4)
		img = 0;
}
setInterval("slideshow()", 5000);

// ************************************************************
